Problem: $f(x) = \begin{cases} x +1 & \text{for} ~~~~x\lt0 \\ \cos(\pi x) & \text{for} ~~~~ x \geq0\end{cases}$ Evaluate the definite integral. $\int^1_{-1}f(x)\,dx = $ Choose 1 answer: Choose 1 answer: (Choice A) A $\dfrac12$ (Choice B) B $-\dfrac12$ (Choice C) C $\dfrac12 + \dfrac1\pi$ (Choice D) D $\dfrac12 - \dfrac1\pi$
Splitting up the definite integral Since we're working with a piecewise function, we need to split the definite integral up into two pieces: $\phantom{=} \int^1_{-1}f(x)\,dx$ $= \int^0_{-1}f(x)\,dx + \int^1_{0}f(x)\,dx~~~~~~$ [Why did we split at 0?] $= \int^0_{-1}(x + 1)\,dx + \int^1_{0}\cos(\pi x)\,dx ~~~~~~$ Evaluating each piece Next, let's evaluate each of these definite integrals one at a time. The first definite integral: $\begin{aligned} \int^0_{-1}\big(x + 1\big)\,dx~ &=\dfrac12x^2 + x\Bigg|^0_{{-1}} \\\\ &= \left[\dfrac12\cdot ( 0)^2 + (0 )\right] - \left[\dfrac12\cdot({-1})^2 + ({-1}) \right] \\\\ &= \left[0\right] -\left[-\dfrac12 \right] \\\\ &= {\dfrac12}\end{aligned}$ The second definite integral: $\begin{aligned} \int^1_{0}\cos(\pi x)\,dx~ &=\dfrac{\sin(\pi x)}{\pi}\Bigg|^1_{{0}} \\\\ &= \left[\dfrac{\sin(\pi \cdot 1)}{\pi}\right] - \left[\dfrac{\sin(\pi \cdot 0)}{\pi}\right] \\\\ &= \left[\dfrac{\sin(\pi)}{\pi}\right] - \left[\dfrac{\sin(0)}{\pi}\right] \\\\ &= [0] - [0] \\\\ &= {0}\end{aligned}$ Putting the pieces together Now let's add these two pieces together to find the answer: $\phantom{=} \int^0_{-1}(x + 1)\,dx + \int^1_{0}\cos(\pi x)\,dx$ $ = {\dfrac12} + {0}$ $ = \dfrac12$ The answer $\int^1_{-1}f(x)\,dx = \dfrac12$